package com.example.jbmsuppliers.sinopec.activity;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;

import com.example.jbmsuppliers.sinopec.utlis.ExitAppUtlis;
import com.example.jbmsuppliers.sinopec.view.MyToast;

/**
 * Created by 家帮忙 on 2017/1/12.
 */

public class MessAgeHomeActivity extends Activity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ExitAppUtlis.getInstance().addActivity(this);
    }





    //检测退出时间
    private long curren = 0;
    @Override
    public void onBackPressed() {

        if ((System.currentTimeMillis() - curren) > 2000) {
            MyToast.show(MessAgeHomeActivity.this, "再按一次退出", 0);
            curren = System.currentTimeMillis();

        } else {
            getSharedPreferences("open_key_judge", Activity.MODE_PRIVATE).edit().clear().commit();
            ExitAppUtlis.getInstance().exit();


        }


    }
}
